<?php
include_once( "{$_SERVER['DOCUMENT_ROOT']}/header.php");
$r->update($TABLE, "where uid = '$bbs_uid'", "read_count=read_count+1");
$result = $r->return_result_by_object($TABLE, "where uid ='$bbs_uid'", $field = "*");

//비로그인 글쓰기 하면 
if (!$result->user_num) {
    $name = "<div class='gray inline' >$result->user_nick</div>";
} else {
    $name = "<div class='hand inline black' onClick=\"bbs.loadMenu('member_info','{$FOLDER_PATH}/user_info.php?user_num={$result->user_num}','300','180',$(this).offset());\">$result->user_nick</div>";
}


if ($result->ip_addr) {
    $ip = explode('.', $result->ip_addr);
    $ip = "$ip[0].***.***.$ip[3]";
} else {
    exit;
}

$parent_uid = $bbs_uid;

$date = $_F->getDateFormat($result->reg_date, 6);

if ($result->mod_date) {
    $date.="(수정함 : " . $_F->getDateFormat($result->mod_date, 6) . ")";
}

$this_bbs = "&bbs_uid=$bbs_uid&bbs_sort=$result->sort"; // 현재의 글을 의미한다.
?>

<table width="100%" valign="top" cellpang="0" cellspacing="0" >
    <tr>
        <td class="font_l_black" colspan="5"><?= $categoryTitle; ?>
        </td>
    </tr>
    <tr>
        <td bgcolor="#E5E5E5" height="75">
            <table width="100%" valign="top" cellpang="0" cellspacing="0">
                <tr>
                    <td class=" padding left f_15 top"><?= $result->board_subject; ?></td>
                </tr>
                <tr>
                    <td class="padding right bottom gray f_12">글번호 : <?= $result->ord_num; ?>&nbsp;&nbsp; 조회: <?= $result->read_count; ?>&nbsp;&nbsp;
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td  valign="top" class="padding center" style="height:400px;">
            <div style="width:100%; height:auto; text-align: left;"><?= $result->board_content; ?></div>
            <div style="width:100%; text-align: left; bottom:0px; font-size: 12px; color: gray;">ip: <?= $ip; ?><br>작성자: <?= $name; ?> <br>작성일: <?= $date; ?></div>
        </td>
    </tr>
    <tr>
        <td bgcolor="#C3C3C3" height="1"></td>
    </tr>
    <tr>
        <td align="center" class="padding">
            <input type="image" value="목록" title="목록" src="<?= $FOLDER_PATH; ?>/img/bt_list.gif" onClick=" bbs.swapPage('<?= $PAGE_LIST; ?>', '<?= $layer_id; ?>');
                    return false">

            <input type="image" value="수정" title="수정" src="<?= $FOLDER_PATH; ?>/img/bt_modify.gif" onClick="bbs.showDiv('mod_<?= $bbs_uid; ?>');">
            <input type="image" value="삭제" title="삭제" src="<?= $FOLDER_PATH; ?>/img/bt_delete.gif" onClick="bbs.showDiv('del_<?= $bbs_uid; ?>');
                   ">
            <div id="mod_<?= $bbs_uid; ?>" style="display: none; height: 30px;">
                <input type="password" id="mod_passwd_<?= $bbs_uid; ?>" onmouseover="bbs.getFocus(this);">
                <input type="image" value="수정" title="수정" src="<?= $FOLDER_PATH; ?>/img/bt_modify.gif"  onClick="var pw = $('#mod_passwd_<?= $bbs_uid; ?>').val();
                        bbs.swapPage('<?= $PAGE_MOD . $this_bbs; ?>&pw=' + pw, '<?= $layer_id; ?>');">
                <a onClick="bbs.hideDiv('mod_<?= $bbs_uid; ?>');
                        return false"><img src='<?= $FOLDER_PATH; ?>/img/bt_x.gif' border=0></a>
            </div>
            <div id="del_<?= $bbs_uid; ?>" style="display: none; height: 30px;">
                <input type="password" id="del_passwd_<?= $bbs_uid; ?>" onmouseover="bbs.getFocus(this);">
                <input type="image" value="삭제" title="삭제" src="<?= $FOLDER_PATH; ?>/img/bt_delete.gif" onClick="var pw = $('#del_passwd_<?= $bbs_uid; ?>').val();
                        bbs.swapPage('<?= $PAGE_DEL . $this_bbs; ?>&pw=' + pw + '&token=<?= $_F->makeToken($SESSION_DEL); ?>', '<?= $layer_id; ?>');
                       ">
                <a onClick="bbs.hideDiv('del_<?= $bbs_uid; ?>');
                        return false"><img src='<?= $FOLDER_PATH; ?>/img/bt_x.gif' border=0></a>
            </div>
        </td>
    </tr>
    <tr>
        <td id="comment"></td>
    </tr>
</table>
<script  language='JavaScript' charset='utf-8'>
    $(document).ready(function () {
        //alert("comment");
        bbs.swapPage('/noritu/bbs/comment/main.php?comment=show&layer_id=comment&category=comment&parent_uid=<?= $parent_uid; ?>&write_commnet=<?= $write_commnet; ?>', 'comment');
    });
    //코멘트 보이게     

</script>